package easy;

public class Solution_883 {

    public int projectionArea(int[][] grid) {
        int count_z = 0, count_x = 0, count_y = 0;
        int[] array = new int[grid[0].length];
        for (int i = 0; i < grid.length; i++) {
            int temp_max = 0;
            for (int j = 0; j < grid[i].length; j++) {
                temp_max = Math.max(temp_max, grid[i][j]);
                if (grid[i][j] > 0) {
                    count_z++;
                }
                array[j] = Math.max(array[j], grid[i][j]);
            }
            count_x += temp_max;
        }
        for (Integer integer : array) {
            count_y += integer;
        }
        System.out.println("count_x:" + count_x);
        System.out.println("count_y:" + count_y);
        System.out.println("count_z:" + count_z);
        return count_x + count_y + count_z;
    }

    public static void main(String[] args) {
        Solution_883 model = new Solution_883();
        System.out.println(model.projectionArea(new int[][]{{1, 2}, {3, 4}}));
        System.out.println(model.projectionArea(new int[][]{{1, 0}, {0, 2}}));
        System.out.println(model.projectionArea(new int[][]{{1, 1, 1}, {1, 0, 1}, {1, 1, 1}}));
    }
}
